package com.maslyk.invitation;

import com.maslyk.invitation.exception.LogicalException;

/**
 *
 * @author kris
 */
public class MessageBean
{
    private Throwable exception;
    private String header;
    
    public MessageBean()
    {
    }
    
    public MessageBean(Throwable ex)
    {
        if (ex instanceof LogicalException)
        {
            setHeader(((LogicalException)ex).getHeader());
            exception = ex;
        }
        else
        {
            exception = ex;
        }
    }
    
    public Throwable getException()
    {
        return exception;
    }

    public void setException(Throwable exception)
    {
        this.exception = exception;
    }
    
    public String getMessage()
    {
        if(exception != null)
            return exception.getMessage();
        else
            return null;
    }
    
    public boolean getIsMessage()
    {
        return exception != null;
    }

    public String getHeader()
    {
        return header != null ? header : "Blad";
    }

    public void setHeader(String header)
    {
        this.header = header;
    }
    
    
}
